package ltd.dujiabao.capability.domain.capmng.cap;

import java.util.Objects;

/**
 * @author : DuJiabao
 * @Project : ddd-capability
 * @Time : 2024/4/13 12:13
 * @Desc :
 */
public class CapabilityIdentity {
    private final String devModelId;

    private final String hardwareVer;

    private final String firmwareVer;

    public CapabilityIdentity(String devModelId, String hardwareVer, String firmwareVer) {
        this.devModelId = devModelId;
        this.hardwareVer = hardwareVer;
        this.firmwareVer = firmwareVer;
    }

    public String getDevModelId() {
        return devModelId;
    }

    public String getHardwareVer() {
        return hardwareVer;
    }

    public String getFirmwareVer() {
        return firmwareVer;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CapabilityIdentity that = (CapabilityIdentity) o;

        if (!Objects.equals(devModelId, that.devModelId)) return false;
        if (!Objects.equals(hardwareVer, that.hardwareVer)) return false;
        return Objects.equals(firmwareVer, that.firmwareVer);
    }

    @Override
    public int hashCode() {
        int result = devModelId != null ? devModelId.hashCode() : 0;
        result = 31 * result + (hardwareVer != null ? hardwareVer.hashCode() : 0);
        result = 31 * result + (firmwareVer != null ? firmwareVer.hashCode() : 0);
        return result;
    }
}
